package edu.snake.implement.command.frog;

import edu.snake.core.controller.ArenaController.Direction;
import edu.snake.core.controller.command.Algorithm;
import edu.snake.implement.command.AbstractCommand;
import edu.snake.implement.controller.character.BaseCharacterController;


public class FrogDirection extends AbstractCommand implements Algorithm {


    public FrogDirection(BaseCharacterController controller) {
        super(controller);
    }

    @Override
    public void action() {
        Direction direction;
        int random = (int) (Math.random() * 4);
        switch (random) {
            case 1:
                direction = Direction.RIGHT;
                break;
            case 2:
                direction = Direction.DOWN;
                break;
            case 3:
                direction = Direction.LEFT;
                break;
            default:
                direction = Direction.UP;
                break;
        }
        controller.setDirection(direction);
    }
}
